<!--  -->
<template>
  <div class="app-container">
    <el-form :inline="true" size="small">
      <el-form-item label="订单编号">
        <el-input
          v-model="kwd1"
          placeholder="请输入订单编号"
          size="small"
        ></el-input>
      </el-form-item>
      <el-form-item label="状态">
        <el-select v-model="kwd2" placeholder="状态" clearable filterable>
          <el-optionlabel ="已付款" value="payed" />
          <el-optionlabel ="已发货" value="send" />
          <el-optionlabel ="已收货" value="checked" />
          <el-optionlabel ="交易完成" value="finish" />
        </el-select>
      </el-form-item>

      <el-button
        icon="el-icon-search"
        type="primary"
        size="small"
        @click="search"
        >搜索</el-button
      >
      <el-button icon="el-icon-refresh" size="small" @click="restart"
        >重置</el-button
      >
      <el-button icon="el-icon-refresh" size="small" @click="restart"
        >导出</el-button
      >
      <el-button
        class="ref-btn"
        icon="el-icon-refresh"
        circle
        @click
      ></el-button>
    </el-form>

    <el-table :data="tableData" border stripe>
      <el-table-column
        type="selection"
        width="60"
        align="center"
      ></el-table-column>

      <template v-for="(i, index) in columns">
        <el-table-column
          v-if="index == 9"
          :key="i.id"
          :label="i.label"
          show-overflow-tooltip
          align="center"
          :width="i.width"
        >
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.isHome"
              :active-value="1"
              :inactive-value="2"
              @change
            ></el-switch>
          </template>
        </el-table-column>
        <el-table-column
          v-else-if="index == 11"
          :key="i.id"
          :label="i.label"
          show-overflow-tooltip
          align="center"
          :width="i.width"
        >
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.isUsed"
              :active-value="1"
              :inactive-value="0"
              @change
            ></el-switch>
          </template>
        </el-table-column>

        <el-table-column
          v-else
          show-overflow-tooltip
          :prop="i.data"
          :key="i.id"
          :label="i.label"
          align="center"
          :width="i.width"
        />
      </template>
      <el-table-column align="center" label="操作" width="230">
        <template slot-scope="scope">
          <el-button
            type="text"
            icon="el-icon-search"
            @click="detail(scope.row)"
            >查看</el-button
          >
          <el-button
            type="text"
            icon="el-icon-delete"
            style="color: #f66"
            @click="del(scope.$index, scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="page">
      <el-pagination
        @size-change="sizeChange"
        @current-change="currentChange"
        :current-page.sync="page"
        :page-sizes="[20, 40, 80, 100]"
        :page-size="limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        background
      ></el-pagination>
    </div>

    <!-- 对话框 -->
    <el-dialog
      title="查看"
      :visible.sync="showDialog"
      width="40%"
      @close="showDialog = false"
    >
      <div class="dBox">
        <div class="dList">
          <div class="dLabel">订单编号</div>
          <div class="dCon">0012021032611207263</div>
        </div>
        <div class="dList">
          <div class="dLabel">订单分类</div>
          <div class="dCon">课程</div>
        </div>
        <div class="dList">
          <div class="dLabel">下单手机号</div>
          <div class="dCon">17678029384</div>
        </div>
        <div class="dList">
          <div class="dLabel">订单总额</div>
          <div class="dCon">￥193</div>
        </div>
        <div class="dList">
          <div class="dLabel">订单状态</div>
          <div class="dCon">已付款</div>
        </div>
        <div class="dList">
          <div class="dLabel">订单进度</div>
        </div>
        <div style="width: 500px; margin: 0 auto">
          <el-steps :space="200" :active="2" align-center>
            <el-step title="已付款"></el-step>
            <el-step title="待发货"></el-step>
            <el-step title="待收货"></el-step>
            <el-step title="待确认"></el-step>
          </el-steps>
        </div>
      </div>

      <span slot="footer">
        <el-button @click="showDialog = false">取消</el-button>
        <el-button type="primary" @click>确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { getArticle } from "@/api/article";
export default {
  name: "slider",
  data() {
    return {
      kwd1: "",
      kwd2: "",
      status: "",
      keyword: "",

      page: 1,
      limit: 10,
      total: 10,
      queryId: "",
      dialogTitle: "创建",
      showDialog: false,
      form: {},
      tableData: [
        {
          id: "1",
          name: "测测额",
          percent: "1%",
          member: "20",
          student: "30",
          price: "40",
          blong: "商品分类1",
          classify: "实体",
          cover: "11",
          isHome: 1,
          count: "2222",
          isUsed: 1,
        },
        {
          id: "2",
          name: "测测额",
          percent: "1%",
          member: "20",
          student: "30",
          price: "40",
          blong: "商品分类1",
          classify: "实体",
          cover: "11",
          isHome: 1,
          count: "2222",
          isUsed: 1,
        },
        {
          id: "3",
          name: "测测额",
          percent: "1%",
          member: "20",
          student: "30",
          price: "40",
          blong: "商品分类1",
          classify: "实体",
          cover: "11",
          isHome: 1,
          count: "2222",
          isUsed: 1,
        },
      ],

      columns: [
        { key: 0, label: `订单编号`, data: "id", width: "190" },
        { key: 1, label: `订单分类`, data: "name", width: "180" },
        { key: 2, label: `下单手机号`, data: "percent" },
        { key: 3, label: `订单总额`, data: "member" },
        { key: 4, label: `订单状态`, data: "student", width: "120" },
      ],
    };
  },
  created() {},
  methods: {
    add() {
      this.form = {};
      this.showDialog = true;
    },
    detail(i) {
      this.form = i;
      this.showDialog = true;
    },
    del(i, d) {
      this.$confirm("确认删除所选数据？", "确认删除", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.tableData.splice(i, 1);
        })
        .catch(() => {});
    },
    search() {},
    restart() {},
    mudelete() {},

    sizeChange() {},
    currentChange() {},
  },
};
</script>
<style scoped>
.slideImg {
  width: 140px;
}
</style>
